#include <iostream>
#include <vector>
#include <string>
#include <Vector.hpp>

using namespace std;

class Solution
{
public:
    vector<string> summaryRanges(vector<int> &nums)
    {
        if(nums.empty())
            return {};
        vector<pair<int, int>> ranges;
        int start = 0;
        for (int i = 1; i < nums.size(); i++)
        {
            if (nums[i] != nums[i - 1] + 1)
            {
                ranges.push_back({nums[start], nums[i - 1]});
                start = i;
            }
        }
        ranges.push_back({nums[start], nums.back()});
        vector<string> ans;
        for (auto p : ranges)
        {
            if (p.first == p.second)
                ans.push_back(to_string(p.first));
            else
                ans.push_back(to_string(p.first) + "->" + to_string(p.second));
        }
        return ans;
    }
};

int main()
{
    cout << "Code228" << endl;
    Solution s;
    auto ans = s.summaryRanges(vector<int>{});
    PrintVector(ans);
    return 0;
}